Skip to content

[_]: chore/error handler#55

Merged
jzunigax2 merged 2 commits intomasterfrom
chore/error-handler
Feb 3, 2026
Merged

[_]: chore/error handler#55
jzunigax2 merged 2 commits intomasterfrom
chore/error-handler

Conversation

@jzunigax2
Copy link
Contributor

What

Global HTTP exception filter for the meet-server, based on the existing implementation in drive-server.

Why

Error handling was scattered across individual controllers with inconsistent logging and try/catch blocks. A centralized filter standardizes error responses and logging while removing boilerplate from controllers.

How

  • Added HttpGlobalExceptionFilter extending NestJS BaseExceptionFilter, modeled after drive-server's implementation
  • Registered it globally via APP_FILTER in AppModule
  • Classifies exceptions into: HTTP errors, database connection errors (503), and unexpected errors (500)
  • Skips logging for 401, 403, and 404 responses to reduce noise
  • Includes requestId in all log payloads for traceability
  • Removed manual try/catch error handling from CallController
  • Added 17 unit tests covering all error paths and edge cases

@jzunigax2 jzunigax2 requested a review from sg-gs February 2, 2026 23:39
@jzunigax2 jzunigax2 self-assigned this Feb 2, 2026
@jzunigax2 jzunigax2 added the enhancement New feature or request label Feb 2, 2026
@jzunigax2 jzunigax2 force-pushed the chore/error-handler branch from efd9900 to 9490865 Compare February 3, 2026 00:04
await expect(
callController.createCall(mockUserToken.payload),
).rejects.toThrow(InternalServerErrorException);
).rejects.toThrow('Unexpected error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be an error object, rather than a string?

const message =
typeof res === 'object' && res !== null
? res
: { statusCode: status, message: res };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can and should return the requestId here also. Eventually, we can show that on the client apps to show it to the user and even report it to Sentry, to see what happened.

@jzunigax2 jzunigax2 requested a review from sg-gs February 3, 2026 12:54
@jzunigax2 jzunigax2 force-pushed the chore/error-handler branch from 619bcf2 to cb1cffd Compare February 3, 2026 12:55
@jzunigax2 jzunigax2 force-pushed the chore/error-handler branch from cb1cffd to ce44434 Compare February 3, 2026 13:22
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 3, 2026

@jzunigax2 jzunigax2 merged commit 6a7bb59 into master Feb 3, 2026
6 of 7 checks passed
@jzunigax2 jzunigax2 deleted the chore/error-handler branch February 3, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants